package net.wanho.vo;

import lombok.Data;

/**
 * Author：汤小洋
 * Date：2024-08-06 14:09
 * Description：<描述>
 */
@Data
public class R {
    private Boolean success;
    private Integer code;
    private String message;
    private Object data;

    public static R success(){
        R result = new R();
        result.success = true;
        result.setCode(200);
        result.setMessage("success");
        return result;
    }

    public static R success(String message){
        R result = new R();
        result.success = true;
        result.setCode(200);
        result.setMessage(message);
        return result;
    }

    public static R success(Object data){
        R result = new R();
        result.success = true;
        result.setCode(200);
        result.setMessage("success");
        result.setData(data);
        return result;
    }

    public static R success(String message, Object data){
        R result = new R();
        result.success = true;
        result.setCode(200);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public static R error(String message){
        R result = new R();
        result.success = false;
        result.setCode(500);
        result.setMessage(message);
        return result;
    }

    public static R error(Integer code, String message){
        R result = new R();
        result.success = false;
        result.setCode(code);
        result.setMessage(message);
        return result;
    }


}
